import request from '@/utils/request'
export const getEmployeeList = (params) => {
  return request.get('/sys/user', { params })
}
export const exportExcel = () => {
  return request.get('/sys/user/export', {
    responseType: 'blob'
    // responseType 改变接收数据的类型
    // blob 使用blob接收二进制文件流
  })
}
export const getExcelTemplate = () => {
  return request.get('/sys/user/import/template', {
    responseType: 'blob'
  })
}
export const uploadTemplate = (data) => {
  return request.post('/sys/user/import', data)
}
export const DelEmployee = (id) => {
  return request.delete(`/sys/user/${id}`)
}
export const AddEmployee = (data) => {
  return request.post('/sys/user', data)
}
export const getEmployeeDetail = (id) => {
  return request.get(`/sys/user/${id}`)
}

export const UpdateEmployeeDetail = (data) => {
  return request.put(`/sys/user/${data.id}`, data)
}
export const getRoleList = () => {
  return request.get('/sys/role/list/enabled')
}
// 分配-员工-角色
export const assignRoles = (data) => {
  return request.put('/sys/user/assignRoles', data)
}
